#!/bin/sh
# Shell wrapper for calling the various programs for factoring with pGNFS
# 2005 - pleslie@pgnfs.org


usage="
***********************************************************************
*              Script for factoring with pGNFS  !!!!!!                *
*                                                                     *
*              usage: ./factor_pgnfs.sh <input>                       *
*                                                                     *
*       Where <input> has the format described in help.txt            *
*                                                                     *
***********************************************************************
"

if [ -z $1 ]
then
	echo "$usage";
else
	if [ -a $1.poly ] 
	then
		./pgnfs_makebases $1 ;
		./pgnfs_sieve $1 ;
		./pgnfs_linearalg $1 ;
		./pgnfs_sqrt $1	 ;
	else
		echo "";
		echo "-------------------------------------------------------";
		echo "		Running polynomial selector ";
		echo "		- stop at any time using CTRL-C ";
		echo "		- and call the script again..... ";
		echo "		- Then it will continue with the ";
		echo "		- polynomial found !!!! ";
		echo "-------------------------------------------------------";
		echo "";
		
		./pgnfs_polyselector $1 
	fi
fi
